﻿using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CPFrameWork.Filter
{
	public class ExceptionFilter : Attribute, IExceptionFilter
	{
		public ExceptionFilter()
		{
			_logger = LogManager.GetCurrentClassLogger();
		}
		private readonly Logger _logger;

		public void OnException(ExceptionContext context)
		{

			_logger.Error(context.Exception, "出现错误");
		}
	}
}
